package com.aidex.common.core.domain;

import com.aidex.common.core.domain.entity.SysDept;
import com.aidex.common.core.domain.entity.SysMenu;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;
import java.util.List;

@Data
@Api(tags = "Treeselect树结构实体类")
public class TreeSelect implements Serializable {
    private static final long serialVersionUID = 1L;
    @ApiModelProperty("节点ID")
    private String id;

    @ApiModelProperty("节点文本")
    private String label;

    /**
     * 子节点
     */
    @JsonInclude(JsonInclude.Include.NON_EMPTY)
    private List<TreeSelect> children;

    public TreeSelect() {

    }

    public TreeSelect(SysDept dept) {
        this.id = dept.getId();
        this.label = dept.getDeptName();
    }

    public TreeSelect(SysMenu menu) {
        this.id = menu.getId();
        this.label = menu.getMenuName();
    }
}
